1. Field of the invention
The present invention relates to an image generating apparatus and an image generating method for temporarily storing image data on a storage medium and reading the stored image data with predetermined timing to generate an image frame, and a computer readable medium.
2. Related Art
Apparatuses that output video signals for displaying a screen on a display, such as a personal computer or a television, generally have a buffer called a frame buffer which is memory for saving information on an output image (a set of pixel data making up a screen) because timing of generating an image through internal processing does not always correspond with that of image signals requested by the display. In a frame buffer, a picture to be rendered is typically sequentially written from top to bottom and sequentially read out from top to bottom at regular intervals for outputting video signals as illustrated in FIG. 1. As a display typically shows a moving image, these operations are repeated and the screen is updated in accordance with the frame buffer which is continually updated. For example, as a typical display has a refreshing rate of 60 Hz and the like, reading takes place at a cycle of 60 times per second. Timing of writing depends on implementation.
However, a problem with simply making such a way of accesses to a single frame buffer is that reading takes place during writing. More specifically, since the speed of reading scan is not always the same as that of writing scan, there can be a phenomenon in which reading scan overtakes writing scan, or conversely, writing scan overtakes reading scan, for example. FIG. 2 illustrates the former case, where an image frame that immediately precedes a point at which an overtaking occurred is read in and displayed on an output screen, resulting in a screen that contains frames of different times together. This causes a phenomenon called tearing, which means incoherence of the screen. For instance, when an object moving rightward is being displayed on the screen, the object looks like sectioned.
To solve this problem, in conventional practices, frame buffers are provided in a double buffer configuration as shown in FIG. 3, wherein writing is alternately done to two buffers and reading is always performed from one of the buffers that is not being written (JP-A 2005-338498 (Kokai)). This can eliminate occurrence of overtaking and prevent the screen incoherence.
A television screen is updated in its entirety at every frame, whereas a screen of a personal computer, for example, is often updated partially because most part of the screen does not move. For example, when characters are entered as shown in FIG. 4, only an area in which the characters are displayed is updated, and when a document is scrolled as depicted in FIG. 5, only an area in which the document is displayed is updated. When a moving image is being displayed, only an area in which the moving image is displayed is updated in a similar way. When a moving image is being displayed on the entire screen, the entire screen will be updated. Thus, on a screen of a personal computer and the like, only a portion of the screen that requires screen updating is updated in many cases. Describing this with respect to the operation of the frame buffer mentioned above, reading is performed at regular intervals, e.g., 60 Hz, in accordance with the refresh rate of the display to read out the entire screen, whereas writing is conducted with random timing so as to write only a partial area of a screen that requires updating to the frame buffer as illustrated in FIG. 6.
Since the timing of writing nevertheless does not correspond with the reading cycle even when writing is partial, the problem of overtaking mentioned above similarly occurs. It is therefore desirable to apply the double buffer method to this, but it would present such a problem as follows. First, suppose that such updating as illustrated in FIG. 7 is performed in a single buffer: a star (1) is first drawn on the left and then a star (2) on its right to finally produce a screen on which the two stars (1) and (2) are drawn. Performing this simply with two buffers, the star (1) is first written in the left buffer which is being a write buffer, as shown in FIG. 8. Assuming that a switching of buffers takes place after it, the star (2) is written to the right buffer which has become the next write buffer. At this point, reading is performed from the left buffer, so that the star (1) previously drawn is properly read out. However, when a buffer switching takes place thereafter, the right buffer will be read next. But since only the star (2) is written and not the star (1) in the right buffer, only the star (2) will be displayed on the screen. This is a problem resulting from written images being partial.
A simple way of avoiding this would be such operations as shown in FIG. 9. First, the star (1) is written to the left buffer as the write buffer. When a buffer switching subsequently takes place, an updated area of the left buffer which has been the write buffer, namely the star (1), is copied to the right buffer which is going to be the next write buffer. Thereafter, the star (2) is written to the right buffer. Consequently, when the right buffer becomes the read buffer next time, an image frame in which the stars (1) and (2) are drawn can be read from the right buffer.
Thus, application of the double buffer method to a case where an image frame is updated with partial writing would involve operations of, when an updated area is written to one of the buffers, writing the same contents to the other buffer after a buffer switching and then writing a new updated area to the other buffer in order to maintain consistency between the two buffers. However, when compared to the single buffer method, this method has increased memory accesses due to the additional necessity of copy between the buffers at the time of buffer switching. This leads to a problem of increased power consumption and the like.
As outlined above, conventional methods have a problem of increase of memory access when applying the double buffer method to a system which updates image frames with partial writing.
The present invention provides an image generating apparatus, an image generating method, and an image generating program that reduce power consumption by eliminating the necessity to copy a written image between buffers and reducing memory accesses to frame buffers.